<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title><s:property value="title"/></title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	
	<link href="css/bbs.css" rel="stylesheet" type="text/css"/>
	<link href="css/pagination.css" rel="stylesheet" type="text/css"/>

  </head>
  
  <body>
    <s:include value="/top.jsp"></s:include>
    	<!-- 导航条 -->
    	<div class="nav_div">
	    	<div style="width: 940px; margin: auto; position: relative;">
	    		<span>您搜索的条件为：${query }&nbsp;&nbsp;<span style="color: red;"><s:property value="message"/></span></span>
	    	</div>
	    </div>
    
    	<br/><br/>
    	<div class="main_div">
    		<br/>
    			
    			<div class="module_div">
    				<div style="width: 100%; height: 30px; background-repeat: repeat-x;">
		    			<br/>
		    		</div>
		    		<div class="table_div">
		    			<table>
		    				<tr style="background-color: #FC3; text-align: center;">	
		    					<td style="width: 60%" colspan="2">主题</td>
			    				<td>回复</td>
			    				<td>作者</td>
			    				<td>阅读</td>
			    				<td>最新回复</td>
		    				</tr>
		    				
		    				<s:iterator id="post" value="postList">
		    					<tr style="font-size: 12px; background-color: #e7e7e7;">
			    					<td style="width: 10%; text-align: center;">
			    					<!-- 帖子状态图标 -->
			    					<s:if test="#post.selectCount >= 100 && #post.replyCount >= 20">
			    						<img src="images/bbs/elite_post_icon.png"/><br/>
			    						<span>热门帖子</span>
			    					</s:if>
			    					<s:elseif test="#post.reportCount >= 20">
			    						<img src="images/bbs/report_icon.png"/><br/>
			    						<span>被警告帖</span>
			    					</s:elseif>
			    					<s:else>
			    						<img src="images/bbs/post_icon.png"/>
			    					</s:else>
			    					<!-- 帖子状态图标  end -->
			    					</td>
			    					<td>
			    					<s:a href="reply_list?post_id=%{#post.id}"><span style="color: black;">[${post.board.name }]</span>&nbsp;${ post.name }</s:a>
			    					<br/>
			    					创建时间：<fmt:formatDate value="${ post.dateCreated }" pattern="yyyy/MM/dd HH:mm:ss" />
			    					<% 
			    						HttpSession httpSession = request.getSession();
			    						Object obj = httpSession.getAttribute("sessionUser");
			    						if(obj != null){ 
			    					%>
			    					<s:if test="#post.reportCount >= 20">
			    					<br/>
			    					--------<s:a href="post_delete?post_id=%{#post.id}&historyURI=post_list?board_id=%{#post.board.id}" cssStyle="color: red;" onclick="return checkDelete()">删除此帖</s:a>-- 版主具有此权限
			    					<img src="images/bbs/report_icon.png"/><span style="color: red;">该帖被举报<s:property value="#post.reportCount"/>次</span>
			    					</s:if>
			    					<% 
			    						}
			    					%>
			    					
			    					</td>
			    					<td style="text-align: center;">${ post.replyCount }</td>
			    					<td style="text-align: center;"><s:a href="user_selectUser?selectAccount=%{#post.user.account}">${ post.user.account }</s:a></td>
			    					<td style="text-align: center;">${ post.selectCount }</td>
			    					<td style="text-align: center;">
			    					<s:a href="user_selectUser?selectAccount=%{#post.userLastReplied.account}">${ post.userLastReplied.account }</s:a>-- 
			    					<s:a href="reply_list?post_id=%{#post.id}">点击查看</s:a>
			    					<br/>
			    					<span>回复时间：<fmt:formatDate value="${post.dateLastReplied}" pattern="yyyy/MM/dd HH:mm:ss" /></span>
			    					</td>
			    				</tr>
		    				</s:iterator>
		    			</table>
		    		</div>
    			</div>
    			<br/>
	    		<div class="pagination_div">
	    			${ pagination }
	    		</div>
	    		<br/>
    	</div>
    
    <s:include value="/bottom.jsp"></s:include>
  </body>
</html>
